package com.briup.ch11;

import java.io.Serializable;

/**
 * @author briup-adam
 * @date 2023/10/23 下午2:44
 * @description
 * 如果一个对象想要序列化 这个对象对应的类型 一定要是实现序列化接口
 * @see java.io.Serializable
 *
 **/

public class Student  implements Serializable {
    final static long serialVersionUID=5024084759952330912l;
    private  String name;
    private int age;
    //序列化的时候 忽略该属性
    private transient String password;
    private  String gender;

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", password='" + password + '\'' +
                ", gender='" + gender + '\'' +
                '}';
    }

    public Student(String name, int age, String password, String gender) {
        this.name = name;
        this.age = age;
        this.password = password;
        this.gender = gender;
    }


//    @Override
//    public String toString() {
//        return "Student{" +
//                "name='" + name + '\'' +
//                ", age=" + age +
//                ", password='" + password + '\'' +
//                '}';
//    }

    public Student(String name, int age, String password) {
        this.name = name;
        this.age = age;
        this.password = password;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Student() {
        System.out.println("这是student的无参构造器");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student(String name, int age) {
        System.out.println("这是student的两参构造器");

        this.name = name;
        this.age = age;
    }
}
